package com.hui.stock.controller;

import com.hui.stock.pojo.domain.PermissionTreeDomain;
import com.hui.stock.pojo.entity.SysPermission;
import com.hui.stock.service.PermissionService;
import com.hui.stock.vo.resp.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: ymh
 * @date: 2024/12/31 16:11
 * @description:
 */
@ApiOperation("权限相关接口")
@RestController
@RequestMapping("/api")
public class PermissionController {

    @Autowired
    private PermissionService permissionService;
    @ApiOperation("查询所有权限集合")
    @GetMapping("/permissions")
    public R<List<SysPermission>> getAllAvailablePermissions(){
        return permissionService.getAllAvailablePermissions();
    }

    @ApiOperation("添加权限时回显权限树,仅仅显示目录和菜单")
    @GetMapping("/permissions/tree")
    public R<List<PermissionTreeDomain>> getPermissionsTree(){
        return permissionService.getPermissionsTree();
    }



}
